<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>添加班级信息</title>
</head>
<link href="${pageContext.request.contextPath}/static/core/css/style.css">
<body>
<style>
    .modal.fade.in {
        top: 90px;
    }
</style>
<script>
    $(function () {
        /*调用初始模态框的方法*/
        modelDisiplay()
    })
    function commint() {
        $(".add-enrol-form").submit();
    }
    /*
  * 模态框中年级列表初始化
  * */
    function modelDisiplay() {
        $.ajax({
            url:_baselocation+"/enrol/enrol/list",
            type: 'post',
            contentType: 'application/json; charset=UTF-8',
            data: null,//一定不能给转成json字符串传过去 结果会是这样""201922101411""
            dataType:"json",
            success: function (result) {
                console.log(result)
                if (result!=null){
                    for (var i=0;i<result.length;i++){
                        $(".class-enrol-id").append('<option value='+result[i].id+'>'+result[i].enrolName+'</option>');
                    }
                }
            },
        });
    }
</script>
<!--主容器-->
<div class="container">
    <div class="row">
        <div class="col-md-12">

            <div class="add-enrol-form-content">
                <h1 class="text-center">添加班级</h1>
                <form class="form-horizontal add-enrol-form" action="${pageContext.request.contextPath}/classes/adddo" method="post">
                    <div class="form-group">
                        <label for="class-code" class="col-sm-2 control-label">年级编号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="classCode"   id="class-code" placeholder="请输入年级编号">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="class-name" class="col-sm-2 control-label">年级名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="className" id="class-name" placeholder="请输入年级名称">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="enrolId" class="col-sm-2 control-label">所属年级</label>
                        <div class="col-sm-10">
                            <select class="form-control class-enrol-id" id="enrolId" name="enrolId">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-5 col-sm-7">
                            <button  class="btn btn-info" onclick="commint()">添加</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

</body>
</html>
